<template>
  <div>
    <el-container>
      <!--侧边栏-->
      <!--min-height:100vh;删除滚动条-->
      <el-aside :width="asideWidth"
                style="min-height:100vh; background-color: #001529">

        <div style="height:60px; color: white; display: flex; align-items:center; justify-content: center">
          <img src="@/assets/LeiTao3.png" alt=""
               style="width: 60px; height: 40px;">
          <span class="logo-title" v-show="!isCollapse">购物</span>
        </div>
        <!--style="border: none 去除边框-->
        <!--router 可以点击-->
        <!--$route.path 当前路由-->
        <!--active-text-color="#fff" 高亮颜色-->
        <!--:collapse-transition="false" 取消收缩动画-->
        <el-menu router
                 :collapse="isCollapse"
                 :collapse-transition="false"
                 background-color="#001529" text-color="rgba(255,255,255,0.65)"
                 active-text-color="#fff"
                 style="border: none" :default-active="$route.path">
          <!--一级菜单-->
          <el-menu-item index="/">
            <i class="el-icon-house"></i>
            <span slot="title">系统首页</span>
          </el-menu-item>
          <el-menu-item index="/1">
              <i class="el-icon-house"></i>
              <span slot="title">系统首页</span>
          </el-menu-item>
          <el-menu-item index="/2">
              <i class="el-icon-house"></i>
              <span slot="title">系统首页</span>
          </el-menu-item>

          <!--二级菜单-->
          <el-submenu>
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>商品管理</span>
            </template>
            <el-menu-item>商品管理</el-menu-item>
            <el-menu-item>商品发布</el-menu-item>
            <el-menu-item>评论管理</el-menu-item>
          </el-submenu>
          <el-submenu>
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>订单管理</span>
            </template>
            <el-menu-item>订单管理</el-menu-item>
            <el-menu-item>退款管理</el-menu-item>
          </el-submenu>
        </el-menu>

      </el-aside>
      <el-container>
        <!--头部区域-->
        <el-header>

          <i :class="collapseIcon"
             style="font-size: 26px; " @click="handleCollapse"></i>

          <el-breadcrumb separator-class="el-icon-arrow-right"
                         style="margin-left: 20px">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: '/user' }">用户管理</el-breadcrumb-item>
          </el-breadcrumb>
          <!--justify-content: flex-end 居右-->
          <div style="flex: 1; width: 0; display: flex; align-items: center;justify-content: flex-end">

            <i class="el-icon-full-screen" style="font-size:26px; margin-right: 20px" @click="handleFull"></i>

            <!--placement="bottom"下拉菜单靠中-->
            <el-dropdown placement="bottom">
              <!--cursor: default;鼠标点击是箭头-->
              <div style="display: flex; align-items: center; cursor: default;">
                <img src="@/assets/LeiTao3.png" alt="" style="width: 100px; height: 50px">
                <span>管理员</span>
              </div>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>个人中心</el-dropdown-item>
                <el-dropdown-item>修改密码</el-dropdown-item>
                <el-dropdown-item @click.native="$router.push('/login')">退出登录</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
        </el-header>
        <!--主体区域-->
        <el-main>
          <div style="box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); padding: 10px 20px; border-redius: 5px; margin-bottom: 10px">
            <strong>商品首页</strong>
          </div>

          <div style="display: flex">
            <el-card style="width:50%; margin-right: 10px ">
              <div slot="header" class="clearfix">
                <span>ASBD</span>
              </div>
              <div>
                LeiTao购物商场
                <div style="margin-left: 20px">
                  <div style="margin: 10px 0"><strong>主题色</strong></div>
                  <el-button type="primary" plain>按钮</el-button>
                  <el-button type="success" plain>按钮</el-button>
                  <el-button type="warning" plain>按钮</el-button>
                  <el-button type="danger" plain>按钮</el-button>
                  <el-button type="info" plain>按钮</el-button>
                </div>
              </div>
            </el-card>
            <el-card style="width:50%">
              <div slot="header" class="clearfix">
                <span>渲染用户的数据</span>
              </div>
              <div>
                <el-table :data="users">
                  <el-table-column label="ID" prop="id"></el-table-column>
                  <el-table-column label="用户名" prop="username"></el-table-column>
                  <el-table-column label="姓名" prop="name"></el-table-column>
                  <el-table-column label="地址" prop="address"></el-table-column>
                </el-table>
              </div>
            </el-card>
          </div>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<script>

import request from "@/utils/request";

export default {
  name: 'HomeView',
  data() {
    return {
      isCollapse: false, //默认不收缩
      asideWidth: '200px',
      collapseIcon: 'el-icon-s-fold',
      users: []
    }
  },
  mounted() {
    request.get('/user/selectAll').then(res => {
      this.users = res.data
    })
  },
  methods: {
    //全屏
    handleFull() {
      document.documentElement.requestFullscreen();
    },
    handleCollapse() {
      this.isCollapse = !this.isCollapse
      this.asideWidth = this.isCollapse ? '64px' : '200px'
      this.collapseIcon = this.isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'
    }
  }
}
</script>

<style>
.el-menu--inline {
  background-color: #000c17 !important;
}
.el-menu--inline .el-menu-item {
  background-color: #000c17 !important;
  padding-left: 49px !important;
}
.el-menu-item:hover, .el-submenu__title:hover i{
  color: #fff !important;
}
.el-submenu__title:hover i {
  color: #fff !important;
}
.el-menu-item.is-active {
  background-color: #1890ff !important;
  border-radius: 20px !important;
}
.el-menu-item {
  height: 40px !important;
  line-height: 40px !important;
}
.el-submenu__title {
  height: 40px !important;
  line-height: 40px !important;
}
.el-aside {
  transition: width 0.3s;
  box-shadow: 2px 0 6px rgba(0,21,41,0.35);
}
.logo-title {
  margin-left: 4px;
  font-size:20px;
  transition: all 0.3s;
}
.el-header {
  box-shadow: 2px 0 6px rgba(0,21,41,0.35);
  display: flex;
  align-items: center;

}


</style>




